﻿using System;
using JTLeigh.Commerce.Spencer.Features.ProductFeedback.Business.Caches;
using JTLeigh.Commerce.Spencer.Features.ProductFeedback.Common.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace JTLeigh.Commerce.Spencer.Features.ProductFeedback.Business.UnitTests.Caches
{

	/// <summary>
	/// Unit tests for the <see cref="NullProductFeedbackMetadataCache"/> class.
	/// </summary>
	[TestClass]
	public class NullProductFeedbackMetadataCacheFixture
	{

		#region Fields

		private static Guid TestTenantId = Guid.NewGuid();
        private const string TestCatalogId = "BaseCatalog";
        private const string TestCategoryId = "ABC";
        private const string TestProductId = "123";

		#endregion // Fields

		#region Methods

		#region ProductFeedbackMetadata

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductFeedbackMetadata"/> 
		/// always returns <see langword="null"/> regardless of whether feedback metadata has been 
		/// added to the cache via <see cref="NullProductFeedbackMetadataCache.SetProductFeedbackMetadata"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductFeedbackMetadata()
		{
			NullProductFeedbackMetadataCache cache;
			ProductFeedbackMetadata metadata;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductFeedbackMetadata(TestTenantId));

			metadata = new ProductFeedbackMetadata();
			cache.SetProductFeedbackMetadata(TestTenantId, metadata);
			Assert.IsNull(cache.GetProductFeedbackMetadata(TestTenantId));
		}

		#endregion // ProductFeedbackMetadata

		#region ProductRatingAttributeCategoryRelations

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductRatingAttributeCategoryRelations"/> 
		/// always returns <see langword="null"/> regardless of whether product rating attribute - 
		/// category relations have been added to the cache via 
		/// <see cref="NullProductFeedbackMetadataCache.SetProductRatingAttributeCategoryRelations"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductRatingAttributeCategoryRelations()
		{
			NullProductFeedbackMetadataCache cache;
			ProductRatingAttributeCategoryRelations relations;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductRatingAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId));

			relations = new ProductRatingAttributeCategoryRelations();
			cache.SetProductRatingAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId, relations);
			Assert.IsNull(cache.GetProductRatingAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId));
		}

		#endregion // ProductRatingAttributeCategoryRelations

		#region ProductRatingAttributeProductRelations

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductRatingAttributeProductRelations"/> 
		/// always returns <see langword="null"/> regardless of whether product rating attribute - 
		/// product relations have been added to the cache via 
		/// <see cref="NullProductFeedbackMetadataCache.SetProductRatingAttributeProductRelations"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductRatingAttributeProductRelations()
		{
			NullProductFeedbackMetadataCache cache;
			ProductRatingAttributeProductRelations relations;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductRatingAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId));

			relations = new ProductRatingAttributeProductRelations();
			cache.SetProductRatingAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId, relations);
			Assert.IsNull(cache.GetProductRatingAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId));
		}

		#endregion // ProductRatingAttributeProductRelations

		#region ProductRecommendationAttributeCategoryRelations

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductRecommendationAttributeCategoryRelations"/> 
		/// always returns <see langword="null"/> regardless of whether product recommendation 
		/// attribute - category relations have been added to the cache via 
		/// <see cref="NullProductFeedbackMetadataCache.SetProductRecommendationAttributeCategoryRelations"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductRecommendationAttributeCategoryRelations()
		{
			NullProductFeedbackMetadataCache cache;
			ProductRecommendationAttributeCategoryRelations relations;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductRecommendationAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId));

			relations = new ProductRecommendationAttributeCategoryRelations();
			cache.SetProductRecommendationAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId, relations);
			Assert.IsNull(cache.GetProductRecommendationAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId));
		}

		#endregion // ProductRecommendationAttributeCategoryRelations

		#region ProductRecommendationAttributeProductRelations

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductRecommendationAttributeProductRelations"/> 
		/// always returns <see langword="null"/> regardless of whether product recommendation 
		/// attribute - product relations have been added to the cache via 
		/// <see cref="NullProductFeedbackMetadataCache.SetProductRecommendationAttributeProductRelations"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductRecommendationAttributeProductRelations()
		{
			NullProductFeedbackMetadataCache cache;
			ProductRecommendationAttributeProductRelations relations;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductRecommendationAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId));

			relations = new ProductRecommendationAttributeProductRelations();
			cache.SetProductRecommendationAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId, relations);
			Assert.IsNull(cache.GetProductRecommendationAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId));
		}

		#endregion // ProductRecommendationAttributeProductRelations

		#region ProductReviewAttributeCategoryRelations

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductReviewAttributeCategoryRelations"/> 
		/// always returns <see langword="null"/> regardless of whether product review attribute - 
		/// category relations have been added to the cache via 
		/// <see cref="NullProductFeedbackMetadataCache.SetProductReviewAttributeCategoryRelations"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductReviewAttributeCategoryRelations()
		{
			NullProductFeedbackMetadataCache cache;
			ProductReviewAttributeCategoryRelations relations;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductReviewAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId));

			relations = new ProductReviewAttributeCategoryRelations();
			cache.SetProductReviewAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId, relations);
			Assert.IsNull(cache.GetProductReviewAttributeCategoryRelations(TestTenantId, TestCatalogId, TestCategoryId));
		}

		#endregion // ProductReviewAttributeCategoryRelations

		#region ProductReviewAttributeProductRelations

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackMetadataCache.GetProductReviewAttributeProductRelations"/> 
		/// always returns <see langword="null"/> regardless of whether product review attribute - 
		/// product relations have been added to the cache via 
		/// <see cref="NullProductFeedbackMetadataCache.SetProductReviewAttributeProductRelations"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductReviewAttributeProductRelations()
		{
			NullProductFeedbackMetadataCache cache;
			ProductReviewAttributeProductRelations relations;

			cache = new NullProductFeedbackMetadataCache();
			Assert.IsNull(cache.GetProductReviewAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId));

			relations = new ProductReviewAttributeProductRelations();
			cache.SetProductReviewAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId, relations);
			Assert.IsNull(cache.GetProductReviewAttributeProductRelations(TestTenantId, TestCatalogId, TestProductId));
		}

		#endregion // ProductReviewAttributeProductRelations

		#endregion // Methods

	}

}
